package com.liu.controller;

import com.liu.bean.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderController {

    @Autowired
    RestTemplate restTemplate;

    @Value("${updatestock}")
    String updatestock;



    @PostMapping("/order")
    public String save(@RequestBody Order order){

        System.out.println("生成订单："+order.toString());
        //更新库存
        restTemplate.put(updatestock+"?goodsId  =10",null);



        return "ok";
    }



}
